﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HouseInput.aspx.cs" Inherits="Admin.House.HouseInput" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>添加出租屋</title>
    <link href="/Admin/Css/rightbar.css?FileVersion=<%=FileVersion %>" rel="stylesheet"
        type="text/css" />
    <script src="/admin/Scripts/Calendar2008.js?FileVersion=<%=FileVersion %>" type="text/javascript"></script>
    <script src="/Admin/Scripts/jquery-1.4.1.min.js?FileVersion=<%=FileVersion %>" type="text/javascript"></script>
    <script src="/admin/Scripts/Check.js?FileVersion=<%=FileVersion %>" type="text/javascript"></script>
</head>
<body id="wallet">
    <div class="warp">
        <div class="topnav">
            <ul>
                <li><a href="HouseList.aspx"><span>商业用房列表</span></a></li>
                <li><a href="javascript:void(0);" style="cursor: default;" class="on_nav"><span>商业用房登记</span></a></li>
            </ul>
        </div>
        <div class="tab mt15">
            <ul>
                <li class="in_on"><strong>商业用房登记</strong></li>
                <li class="caution01">带 <span class="org">*</span> 号为必填项目</li>
            </ul>
        </div>
        <div class="cont" style="padding-top: 8px;" id="stb8">
            <form name="form1" method="post" action="HouseInput.aspx?action=add" id="form1">
            <table width="660" border="0" cellspacing="0" cellpadding="0" class="tb01">
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        <span class="org">*</span>房产证编号：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtCertificateID" name="txtCertificateID" class="input200_out"
                            style="width: 240px;" need="房产证编号必须输入" /><span class="gray pl10">请输入房产证编号</span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        <span class="org">*</span>房主姓名：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtName" name="txtName" class="input200_out" style="width: 240px;"
                            maxlength="25" need="房主姓名不能为空" /><span class="gray pl10">请输入房主姓名，不超过10个汉字</span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        <%--<span class="org">*</span>--%>房主身份证：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtIDCardNum" name="txtIDCardNum" class="input200_out" idcardnum="身份证号格式错"
                            style="width: 240px;" /><span class="gray pl10">请输入房主身份证号码</span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        所属部门：
                    </td>
                    <td align="left" valign="middle">
                        <select id="selDepart" name="selDepart" style="width: 250px;">
                            <option value="0">请选择所属部门</option>
                            <%=OutputSelectOptions(dtDepartmet, "name", "id")%>
                        </select><span class="gray pl10">请选择所属部门</span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        管理人员：
                    </td>
                    <td align="left" valign="middle">
                        <select id="selManager" name="selManager" style="width: 250px;">
                            <option value="0">请选择管理人员</option>
                        </select><span class="gray pl10">请选择管理人员</span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        颁发日期：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtCertificateDate" name="txtCertificateDate" class="input200_out"
                            style="width: 240px;" maxlength="50" date="颁发日期格式错" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        使用期限：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtYearLimit" name="txtYearLimit" class="input200_out" style="width: 240px;"
                            maxlength="50" int="使用期限必须是数字" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        门牌号码：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtBuildingNum" name="txtBuildingNum" class="input200_out"
                            style="width: 240px;" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        所属乡镇：
                    </td>
                    <td align="left" valign="middle">
                        <select name="selXiangzhen" id="selXiangzhen" style="width: 250px;">
                            <option value="">请选择所属乡镇</option>
                            <%=OutputSelectOptions(dtXiangzhen, "name", "id")%>
                        </select><span class="gray pl10">请选择所属乡镇</span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        所属街道：
                    </td>
                    <td align="left" valign="middle">
                        <select name="selJiedao" id="selJiedao" style="width: 250px;">
                            <option value="">请选择所属街道</option>
                        </select><span class="gray pl10">请选择所属街道</span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        所在地段：
                    </td>
                    <td align="left" valign="middle">
                        <select id="selDiduan" name="selDiduan" style="width: 250px;">
                            <option value="0">请选择所在地段</option>
                            <%=OutputSelectOptions(dtDiduan, "name", "id")%>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        土地面积：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtTudiArea" name="txtTudiArea" class="input200_out" style="width: 240px;"
                            maxlength="50" float="土地面积必须位数字" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        房产面积：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtFangchanArea" name="txtFangchanArea" class="input200_out"
                            style="width: 240px;" maxlength="50" float="房产面积必须位数字" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        房产计税面积：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtOriginalPrice" name="txtOriginalPrice" class="input200_out"
                            style="width: 240px;" maxlength="50" float="房产计税面积必须位数字" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        房产原值：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtRemainPrice" name="txtRemainPrice" class="input200_out"
                            style="width: 240px;" maxlength="50" float="房产原值必须位数字" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        房产类型：
                    </td>
                    <td align="left" valign="middle">
                        <select id="selHouseType" name="selHouseType" style="width: 250px;">
                            <option value="">请选择房产类型</option>
                            <option value="闲置">闲置</option>
                            <option value="自用">自用</option>
                            <option value="出租">出租</option>
                            <option value="拆除">拆除</option>
                        </select><span class="gray pl10">请选择房产类型</span>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        房主手机号码：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtMobileCode" name="txtMobileCode" class="input200_out" style="width: 240px;"
                            maxlength="50" mobile="手机号码格式错" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        固定电话号码：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtTelephone" name="txtTelephone" class="input200_out" style="width: 240px;"
                            maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        家庭地址：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtAddress" name="txtAddress" class="input200_out" style="width: 240px;"
                            maxlength="100" />
                    </td>
                </tr>
            </table>
            </form>
        </div>
        <div class="btudiv">
            <ul style="width: 180px;">
                <li>
                    <input name="Submit1" type="submit" id="Submit1" class="button_sure" onclick="return CheckForm()"
                        value="确认添加" /></li>
            </ul>
        </div>
    </div>
    <script type="text/javascript">
        var c = new Calendar("c");
        c.offsetTop = 30;
        document.write(c);

        $(function () {
            //为日期输入框增加日历控件
            $(":input[date]").bind("focus", function (event) {
                c.showMoreDay = false;
                c.show(this); this.
                className = 'input60_on';
                this.onmouseout = ''
            });
        });


        //初始化
        jQuery(function ($) {
            $("#selDepart").change(function () {
                GetManagerList();
            });
            $("#txtCertificateID").blur(function () {
                CheckCertificateID();
            });
            $("#selXiangzhen").change(function () {
                GetJiedaoList();
            });
            $("#selJiedao").change(function () {
                //GetDiduanList();
            });
            <%if(isQueryDepartmentOnly){ %>
            $(":input[name='selDepart']").val('<%=LoginDepartmentID %>');
            $(":input[name='selDepart']").attr('disabled','disabled');
            GetManagerList();
            <%} %>
        });
        //获取房屋信息
        function CheckCertificateID() {
            var certificateID = $("#txtCertificateID").val();
            var url = "/Admin/AjaxPage/HouseInfo.aspx?action=gethouse&CertificateID=" + certificateID + "&timestamp=" + (new Date()).getTime();
            $.ajax({
                url: url,
                dataType: "json",
                success: function (data) {
                    if (data != "") {
                        alert("房产证编号已被房主[" + data[0].Name + "]占用，请修改");
                        $("#Submit1").attr("disabled", true);
                    }
                    else {
                        $("#Submit1").attr("disabled", false);
                    }
                },
                error: function (data) {
                    //alert("验证房屋信息失败，请刷新页面重试!");
                }
            });
        }
        //获取管理员列表
        function GetManagerList() {
            var departmentID = $("#selDepart").val();
            var url = "/Admin/AjaxPage/UserInfo.aspx?action=getmanagerlist&departmentID=" + departmentID + "&timestamp=" + (new Date()).getTime();
            $.ajax({
                url: url,
                success: function (data) {
                    $("#selManager").empty();
                    $("<option value='0'>请选择管理员</option>").appendTo($("#selManager"));
                    $(data).appendTo($("#selManager"));
                },
                error: function (data) {
                    alert("获取管理员信息失败，请刷新页面重试!");
                }
            });
        }
        //获取街道列表
        function GetJiedaoList() {
            var xianzhenID = $("#selXiangzhen").val();
            var url = "/Admin/AjaxPage/DiduanConfig.aspx?action=getjiedaolist&xianzhenID=" + xianzhenID + "&timestamp=" + (new Date()).getTime();
            $.ajax({
                url: url,
                success: function (data) {
                    $("#selJiedao").empty();
                    $("<option value=''>请选择所属街道</option>").appendTo($("#selJiedao"));
                    $(data).appendTo($("#selJiedao"));
                },
                error: function (data) {
                    alert("获取街道信息失败，请刷新页面重试!");
                }
            });
        }
        //获取街道列表
        function GetDiduanList() {
            var jiedaoID = $("#selJiedao").val();
            var url = "/Admin/AjaxPage/DiduanConfig.aspx?action=getdiduanlist&jiedaoID=" + jiedaoID + "&timestamp=" + (new Date()).getTime();
            $.ajax({
                url: url,
                success: function (data) {
                    $("#selDiduan").empty();
                    $("<option value=''>请选择所属地段</option>").appendTo($("#selDiduan"));
                    $(data).appendTo($("#selDiduan"));
                },
                error: function (data) {
                    alert("获取地段信息失败，请刷新页面重试!");
                }
            });
        }
    </script>
    <script type="text/javascript">

        function CheckForm() {
            var obj = document.form1.elements;
            if (!checkAttr(obj)) {
                return false;
            }
            $(":input[name='selDepart']").attr('disabled', '');
            $("#form1").submit();
            return true;
        }
    </script>
</body>
</html>
